package com.zhoutian.service.Impl;

import com.zhoutian.dao.AnnounceDAO;
import com.zhoutian.dao.UserDAO;
import com.zhoutian.entity.Message;
import com.zhoutian.entity.User;
import com.zhoutian.service.AnnounceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
public class AnnounceServiceImpl implements AnnounceService {

    @Autowired
    private AnnounceDAO announceDAO;


    @Override
    public boolean save(Message message) {
        Map<String, Object> map = new HashMap<>();
        map.put("userId", message.getUserId());
        map.put("title", message.getTitle());
        map.put("responsibility", message.getResponsibility());
        map.put("price", message.getPrice());
        map.put("priceWay", message.getPriceWay());
        // 招聘人数
        map.put("num", message.getAllCount());
        // 看好人数
        map.put("allCount", 0);
        map.put("style", message.getStyle());
        map.put("introduce", message.getIntroduce());

        return announceDAO.saveMessage(map) > 0;
    }
}
